/********************************************
 * 功能说明: 
 * 模块名称: 
 * 系统名称: 
 * 软件版权: Frank
 * 系统版本: 1.0.0
 * 开发人员: Frank
 * 开发时间: 2019/9/19 15:10
 * 审核人员: 
 * 相关文档: 
 * 修改记录: 修改日期 修改人员 修改说明
 *********************************************/
package com.spring.arch.job.model;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 任务组
 * @author Frank
 * @version 1.0.0.1
 * @since JDK 1.8
 */
@NoArgsConstructor
@Getter
@Setter
@Entity
@Table(name = "xxl_job_group")
public class JobGroup implements Serializable {

    private static final long serialVersionUID = -4679498531294277192L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(nullable = false, unique = true, insertable = false,  updatable = false)
    private Integer id;

    /**
     * 执行器AppName
     */
    @NotBlank
    @Size(max = 64)
    @Column(name = "app_name", nullable = false)
    private String appName;

    /**
     * 执行器名称
     */
    @NotBlank
    @Size(max = 12)
    @Column(name = "title", nullable = false)
    private String title;

    /**
     * 排序
     */
    @Column(name = "[order]", columnDefinition = "int(11) NOT NULL DEFAULT '0'")
    private int order = 0;

    /**
     * 执行器地址类型：0=自动注册、1=手动录入
     */
    @Column(name = "address_type", columnDefinition = "tinyint(4) NOT NULL DEFAULT '0'")
    private int addressType = 0;

    /**
     * 执行器地址列表，多地址逗号分隔
     */
    @Size(max = 512)
    @Column(name = "address_list")
    private String addressList;

    public JobGroup(@NotBlank @Size(max = 64) String appName, @NotBlank @Size(max = 12) String title, int order, int addressType, @Size(max = 512) String addressList) {
        this.appName = appName;
        this.title = title;
        this.order = order;
        this.addressType = addressType;
        this.addressList = addressList;
    }
}
